<?php

namespace app\expertManagement\controller;
use app\advertisement\logic\ExpertManageLogic;
use app\advertisement\model\ExpertManage as ExpertManageModel;
use app\common\controller\PCBase;
use app\common\library\Upload;

class ExpertManage extends PCBase
{

    /**
     * 模型
     * @var object
     * @phpstan-var ExpertManageModel
     */
    protected object $model;

    public function initialize(): void
    {
        parent::initialize();
        $this->model = new ExpertManageModel();
    }

    /**
     * index
     * @throws Throwable
     */
    public function index()
    {
        $params     = $this->request->post();
        $ExpertManageLogic = new ExpertManageLogic();
        return $ExpertManageLogic->index($params);
    }

    /**
     * @模版下载
     * @throws Throwable
     */
    public function getExportInfo()
    {
        $params   = $this->request->get();
        $ExpertManageLogic = new ExpertManageLogic();
        return $ExpertManageLogic->getExportInfo($params);
    }

    /**
     * export
     * @throws Throwable
     */
    public function export()
    {
        $params     = $this->request->post();
        $ExpertManageLogic = new ExpertManageLogic();
        return $ExpertManageLogic->export($params);
    }

    /**
     * @上传数据
     * @throws Throwable
     */
    public function exportinfo()
    {
        $file       = $this->request->file('file');
        $upload     = new Upload($file);
        $attachment = $upload->upload(null, 1);
        $ExpertManageLogic = new ExpertManageLogic();
        $ExpertManageLogic->getUploadInfo($attachment['url']);
        return  $this->jsonMessage(200, true, "上传成功!",null);
    }



}